import axios from 'axios';
import apiConfig from '@/config';

// 登录 API
const loginApi = async (name, password) => {
  return axios.post(`${apiConfig}/login`, {
    name,
    password,
  });
};

const isAuthenticated = () => {
  // 后端会返回token存储在 localStorage 中
  return localStorage.getItem('authToken') !== null;
};

export { loginApi, isAuthenticated };